
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
  <title>Ruby Library Manager</title>
  <%= stylesheet_link_tag "admin" %>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <script type="text/javascript">
      function checkDelBoxes(parent) {
          var input = document.getElementsByTagName("input");
          for (var i = 0; i < input.length; i++)
              if (input[i].type=="checkbox") {
                  input[i].checked = parent;
              }
      }
      function countSelect()
      {
          var input = document.getElementsByTagName("input");
          var count = 0;
          for (var i = 0; i < input.length; i++)
              if (input[i].type=="checkbox") {
                  if (input[i].checked) count++;
              }
          return count;
      }
  </script>

</head>

<body>
<!-- Header of the page -->
<!-- Your should use ruby code to include header file here, default html can not include file -->
<div id="header">
  <div id="header_infos">
                <span id="header_shopname">
                    <span>Ruby Library Manager</span>
                </span>
                <span id="employee_links">
                    <span class="employee_name">Trang Quản lí</span>
                    <span class="separator"></span>
                    <a id="header_logout" href="/logout">
                      <span>Thoát</span>
                    </a>
                </span>

  </div>
  <ul id="menu">
    <li id="maintab0" class="submenu_size maintab">
                    <span class="title">
                    	<%= image_tag "home-icon.png", :alt => "", :height => 20%>
                      <a style="color:white" href="/admin/home"> Trang chủ </a>
                    </span>
    </li>
    <li id="maintab1" class="submenu_size maintab">
                    <span class="title">
                        <%= image_tag "try-product.png", :alt => "", :height => 20%>
                      <a style="color:white" href="/admin/book"> Sách</a>
                    </span>
    </li>
    <li id="maintab2" class="submenu_size maintab">
                    <span class="title">
                        <%= image_tag "try-category.png", :alt => "", :height => 20%>
                      <a style="color:white" href="/admin/categories"> Danh mục </a>
                    </span>
    </li>
    <li id="maintab3" class="submenu_size maintab">
                    <span class="title">
                        <%= image_tag "try-customer.png", :alt => "", :height => 20%>
                      <a style="color:white" href="/admin/users"> Tài khoản </a>
                    </span>
    </li>
    <li id="maintab4" class="submenu_size maintab">
                    <span class="title">
                        <%= image_tag "try-auction.gif", :alt => "", :height => 20%>
                      <a style="color:white" href="/admin/borrow"> Mượn sách </a>
                    </span>
    </li>
  </ul>
</div>
<!-- Admin Book content -->
<div id="login">
  <div class="clear"></div>
  <div id="admin_content">
    <div class="toolbarBox">
      <div style="float:left;"><h3 style="font-size:18px;margin-left:10px;font-weight: normal;">Tài khoản</h3></div>
      <ul class="cc_button">
        <li>

          <a id="desc-product-new" class="toolbar_btn" title="Thêm" href="/books/new">
            <span class="process-icon-new "></span>
            <div>Thêm</div>
          </a>
        </li>
      </ul>
    </div>

    <div style="text-align:left;font-weight:bold;font-size:13px">
      Tổng cộng có <span style="color:red"><%= User.all.count %></span> sách, hiển thị trong <span style="color:red"><%= @users.num_pages %></span> trang.
    </div>
    <br/>

    <div class="pagination" style="float:left">
      <%= paginate @users %>
    </div>
    <div class="clear"></div>
    <br/>
    <form>

      <table id="product" class="table product" cellspacing="0" cellpadding="0" style="width: 100%; margin-bottom:10px;margin-left:auto;margin-right:auto">
        <colgroup>
          <col width="10px">
          <col width="10px">
          <col width="70px">
          <col width="150px">
          <col width="70px">
          <col width="70px">
          <col width="70px">
          <col width="50">
          <col>
        </colgroup>
        <thead>
        <tr style="height:40px;">
          <th class="center">
            <input class="noborder" type="checkbox" onclick="checkDelBoxes(this.checked)" name="checkme">
          </th>
          <th class="center">
            <a href=""> ID</a>
          </th>

          <th class="center">
            Tên
          </th>

          <th class="center">
            Email
          </th>

          <th class="center">
            Tên đầy đủ
          </th>

          <th class="center">
            Địa chỉ
          </th>

          <th class="center">
            Điện thoại
          </th>

          <th class="center">
            Tùy chọn
          </th>

        </tr>
        </thead>

        <% for item in @users %>
            <tr class="row_hover">
              <td><input type="checkbox" value="<s:property value='id'/>" name="categoryBox[]"/></td>
              <td class="pointer center">
                <%= item.id %>
              </td>
              <td class="pointer center">
                <%= item.name %>
              </td>
              <td class="pointer center">
                <%= item.email %>
              </td>

              <td class="pointer center">
                <%= item.full_name %>
              </td>

              <td class="pointer center">
                <%= item.address %>
              </td>

              <td class="pointer center">
                <%= item.phone_number %>
              </td>

              <td class="pointer center">
                <%= link_to (image_tag "edit.gif", :alt => "Sửa", :height => 20), edit_user_path(item)%>
                <%= link_to image_tag("delete.gif", :alt => "Xóa", :height => 20), item, :method => :delete,
                            :onclick => "if (confirm('Bạn có chắc?')) {return true} else { event.stopPropagation(); event.preventDefault();};"%>

              </td>
            </tr>
        <% end %>
      </table>
      <input type="button" style="background: -moz-linear-gradient(center top , #F9F9F9, #E3E3E3) repeat scroll 0 0 transparent;
              border-color: #CCCCCC #BBBBBB #A0A0A0; border-radius: 3px 3px 3px 3px; border-style: solid; border-width: 1px; color: #000000;margin: 0;
              outline: medium none;
              padding: 3px 8px; float:left;cursor:pointer;"  value="Xóa"
             onclick="if (countSelect()==0)
                     alert('Bạn phải chọn sản phẩm để xóa!');
                     else{
                     if (confirm('Bạn có chắc?')) {alert('Thêm code để xóa nhiều record đi đại ca!')};}
             "/>
    </form>


  </div>
</div>
</body>
</html>

